<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java"  pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Date"%>
<%@page import="com.infodms.dms.po.TmDealerPO"%>
<%@page import="java.util.HashMap"%>
<%@page import="com.infodms.dms.common.Constant"%>
<%
	String contextPath = request.getContextPath();
%>
<%@taglib uri="/jstl/cout" prefix="c" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<jsp:include page="${contextPath}/common/jsp_head_new.jsp" />
<title>首页新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script >
		//初始化时间控件
 function doInit(){
	  	   loadcalendar();	
	  	   
	    }
    KE.show({id : 'contents'});
</script>
</head>
<body>
<div class="navigation">
  <img src="<%=contextPath%>/img/nav.gif" />&nbsp;当前位置： 售后服务管理&gt;个人信息管理&gt;首页新闻</div>
<form name='fm' id='fm' method="post">
<table  class="table_add">
 <tr >
 	<td align="right" nowrap  class="table_add_2Col_label_6Letter">单据编码：
 		<input name="newsCode" value="${newsCode}" type="hidden" />
 		<input name="newsId" value="${newsId}" type="hidden" />
 		<input name="flag" value="${flag}" type="hidden" />
 	</td>
 	<td>${newsCode}</td>
 	<td align="right" nowrap  class="table_add_2Col_label_6Letter">发表单位：</td>
 	<td align="left">${list.COMPANY_NAME}
 		<input type="hidden"  name="companyId" value="${list.COMPANY_ID}"/>
 		<input type="hidden"  name="companyName" value="${list.COMPANY_NAME}"/>
 	</td>
 </tr>
 <tr>
  	<td align="right" nowrap  class="table_add_2Col_label_6Letter">发表人：</td>
 	<td >${list.NAME}
 		<input type="hidden"  name="name" value="${list.NAME}"/>
 	</td>
 	<td nowrap  class="table_add_2Col_label_6Letter">发表日期：</td>
 	<td align="left">${date}</td>
 </tr>
 
 <tr>
 	<td align="right" class="table_add_2Col_label_6Letter">查看类型：</td>
 	<td>
 		<select name="viewNewsType" onChange="checkDealer(this)">
 			<option value="<%=Constant.VIEW_NEWS_type_3 %>">公用</option>
 			<option value="<%=Constant.VIEW_NEWS_type_1 %>">经销商端</option>
 			<option value="<%=Constant.VIEW_NEWS_type_2 %>">OEM端</option>
 		</select>
 	</td>
 	<td align="right"  class="table_add_2Col_label_6Letter" id="msgtypeid" nowrap>消息类型：</td>
 	    <td align="left"  id= "msgtypeid1" nowrap>
 		<select name="Msg_Type" id="Msg_Type">
 			<option value="<%=Constant.MSG_TYPE_3 %>">经销商公用消息</option>
 			<option value="<%=Constant.MSG_TYPE_2 %>">经销商售后消息</option>
 			<option value="<%=Constant.MSG_TYPE_1 %>">经销商销售消息</option>
 		</select>
 	</td> 	
 </tr>
 <tr>
	 <td align="right"  id="q1">增加类别：</td>
	     <td  id="q2">		      
	     <input type="radio" name="mySel" id="r1" checked onclick="areaQuery();"/>区域
	     &nbsp;&nbsp;
	     <input type="radio" name="mySel" id="r2" onclick="dealerQuery();"/>经销商	    
	   </td>
 </tr>
 <tr id="div1" style="display:block">		
        <td id="deId2" class="table_add_2Col_label_6Letter" align="right">区域：</td>
        <td  id="deId3" align="left" nowrap="true" nowrap>
          <input name="orgCode" type="text" id="orgCode" size="40" value="" readonly/>
          <input name="orgId" type="hidden" id="orgId" size="40" value="" />
		  <input name="orgSel" type="button" class="mini_btn" onClick="showOrg('orgCode','orgId',true,'')" value="&hellip;" />
		  <input class="cssbutton" type="button" value="清空" onClick="clrTxt('orgId','orgCode');"/>
        </td>       
 </tr>            
 <tr id="div2" style="display:none">
 		<td align="right" nowrap class="table_add_2Col_label_6Letter" id="deId">选择经销商：</td>
 		<td align="left" nowrap="true" id="deId1">
			<input class="middle_txt" id="dealerCode"  name="dealerCode" type="text"  />
            <input name="showBtn" type="button" class="mini_btn" style="cursor: pointer;" onClick="showOrgDealer2('dealerCode','','true','',true);" value="..." />        
            <input name="clrBtn" type="button" class="normal_btn" onClick="clearInput();" value="清除"/>  
		</td>
 </tr>
 <tr>
 		<td align="right">标题：</td>
 		<td><input name="title" type="text" class="middle_txt" id="title" maxlength="3000" datatype="0,is_null,300"/></td>
 		<td align="right">新闻类别：</td>
 		<td align="left" nowrap="true">
			<script type="text/javascript">
			 genSelBoxExp("NEWS_TYPE",<%=Constant.NEWS_TYPE%>,"",true,"short_sel","","true",'');
	    </script>
	</td>
 </tr>
 <tr>
 	<td align="right">内容:</td>
 	<td colspan="4">
 		<textarea name="contents" id="contents" cols="100" rows="8" style="width:740px;height:200px;">
 		</textarea>
	</td>
 </tr>
</table>
<br />
<table class="table_info" border="0" id="file" >
	<tr colspan="8">
 		<td width="100%" colspan="3">
 		  	<jsp:include page="${contextPath}/uploadDiv.jsp" /> 
 		<input type="button" class="normal_btn"  onclick="showUpload2('<%=contextPath%>')" value ='添加附件'/></td>
 </tr>
 <tr>
 	<td height="23"></td>
	<td height="23"></td>
 	<td colspan="2" align="center">
 		<input class="normal_btn" type="button" name="ok" id="commitBtn" value="确定" onClick="save();"/> 
 		<input class="normal_btn" name="back" type="button" onClick="reBack();" value="返回"/>
 	</td>
 </tr>
</table>


<br />
</form>
<script>

function reBack(){
	location="<%=contextPath%>/claim/basicData/HomePageNews/mainNews.do";
}
$('deId').style.display="none";
$('deId1').style.display="none";
$('deId2').style.display="none";
$('deId3').style.display="none";
$('msgtypeid').style.display="none";
$('msgtypeid1').style.display="none";
$('q1').style.display = "none";
$('q2').style.display = "none";

function checkDealer(obj){
	
	if(obj.value==<%=Constant.VIEW_NEWS_type_1%>){
		$('deId').style.display="block";
		$('deId1').style.display="block";
		$('deId2').style.display="block";
		$('deId3').style.display="block";
		$('msgtypeid').style.display="block";
		$('msgtypeid1').style.display="block";
		$('q1').style.display = "block";
		$('q2').style.display = "block";
	}
	else{
		$('deId').style.display="none";
		$('deId1').style.display="none";
		$('deId2').style.display="none";
		$('deId3').style.display="none";
		$('msgtypeid').style.display="none";
		$('msgtypeid1').style.display="none";
		$('q1').style.display = "none";
		$('q2').style.display = "none";
	}
}
function clearInput(){
	var target = document.getElementById('dealerCode');
	target.value = '';
}

function save(){
    if(document.getElementById("NEWS_TYPE")==null
    	    ||document.getElementById("NEWS_TYPE").value==''){
    	MyAlert("请选择新闻类别！");
    	return false;
    }
    if(document.getElementById("dealerCode")==null
    	    &&document.getElementById("dutyType").value==''){
    	MyAlert("请选择经销商或者区域！");
    	return;
    }
	if(!submitForm('fm')) {
		return false
	}
	fm.action="<%=contextPath%>/claim/basicData/HomePageNews/saveNews.do"
	fm.submit();
}
  //区域单选按钮事件
	function areaQuery(){
		$('div2').style.display = 'none' ;
		$('div1').style.display = 'block';
	}
	//经销商单选按钮事件
	function dealerQuery(){
		$('div1').style.display = 'none' ;
		$('div2').style.display = 'block';
	}  
</script>
</body>
</html>